<template>
	<public-view navType="other" navTitle="余额充值">
		<view class="content">
			<view class="password-input-box f-s-24 flex a-i-c">
				<view class="title">
					充值金额
				</view>
				<input class="ihnput" v-model="amount" @input="changeAmount" type="digit" style="flex: 1;" placeholder="请输入充值金额">
			</view>
			<view class="enter-btn all-center f-s-30 color-fff" @click="changePassword">
				充值
			</view>
			<pay-type-popup ref="payTypePopup" :is_rechange="false" :item="choose_item" @refresh="refreshOrder"></pay-type-popup>
		</view>
	</public-view>
</template>

<script>
	import {mapGetters} from "vuex"
	import {goBack} from "@/nav.js"
	import payTypePopup from "@/components/myComponents/payTypePopup.vue"
	export default {
		components:{
			"pay-type-popup":payTypePopup
		},
		data() {
			return {
				code:"",
				password:"",
				back_time:60,
				interval:"",
				timeout:"",
				amount:"1",
				choose_item:{amount:1,id:""},
				config:[]
			};
		},
		computed:{
			...mapGetters(["userInfo"])
		},
		onLoad() {
			this.config = [this.$store.state.public_config.basic[11],this.$store.state.public_config.basic[12]]
			this.amount = this.config[0].value
			console.log(this.config)
		},
		methods:{
			changeAmount(){
				let that = this
				
			},
			refreshOrder(){
				this.$getUser()
			},
			changeMoney(){
				
			},
			changePassword(){
				let that = this
				if(that.amount === '' || that.amount <= 0 || that.amount === '0'){
					uni.showToast({
						title:"输入的金额不正确",
						icon:"none"
					})
					return
				}
				that.choose_item.amount = that.amount
				that.$refs.payTypePopup.show()
			},
		}
	}
</script>

<style lang="scss" scoped>
	.enter-btn{
		width: 702upx;
		height: 96upx;
		background: #2567F3;
		border-radius: 128upx;
		margin-top: 34upx;
	}
	.password-input-box{
		width: 100%;
		padding: 42upx 40upx;
		background: #FFFFFF;
		border-radius: 20px;
		.ihnput{
			line-height: 34upx;
		}
		.title{
			line-height: 40upx;
			margin-right: 36upx;
		}
	}
	.content{
		width: 750upx;
		padding: 42upx 30upx;
	}
</style>
